Say what is wrong with a pull request number, and test the head ref (#307) - #327
Merged
Merged
Conversation
…penModelica#307) Asking the job for 16360 spent minutes cloning and resetting the OpenModelica repository before failing with "Could not fetch refs/pull/16360/merge: either there is no such pull request, or GitHub cannot merge it into its base branch". Both of those were wrong about what had happened: 16360 is an *issue*. Issues and pull requests share one numbering on GitHub, so an issue number reaches the job looking exactly like a pull request number, and the answer to that is "there is no such pull request", which the message buried as one of two possibilities. The stage now asks GitHub what the number is - one git ls-remote, before the clone, the reset and the build - and says so: OpenModelica/OpenModelica has no pull request 16360. Issues and pull requests share one numbering there, so check that 16360 is not the number of an issue. The checkout separates the two cases as well. GitHub only has refs/pull/<N>/merge while it can merge the pull request into its base branch, so a pull request that conflicts, or one already closed, has only refs/pull/<N>/head. That is still something to test - the pull request on its own rather than as it would land - so it is used, with a warning saying which of the two was tested and what the head ref does not have. Nothing at all for that number is still an error. While here: a parameter is only recorded on a job once a build has run with its definition, so the build that first sees this file has the new ones as null, and every stage that reads them to decide whether to run would fail on it, not only a pull request one. They now fall back to what the definition says the default is. --- Generated by Claude Code.
adrpo
force-pushed
the
fix-pull-request-checkout
branch
from
August 24, 2026 16:14
c20919a to
49eeb1e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #324. Build 11442 asked for 16360, which is not a pull request but an
issue - issues and pull requests share one numbering on GitHub, so an issue
number reaches the job looking exactly like a pull request number.
Two things were wrong with that, neither of them the fetch:
repository, so a number that could have been rejected in a second cost
minutes;
knowable:
git ls-remote refs/pull/16360/*returns nothing at all, so there isno such pull request, full stop.
What changes
The stage asks first. One
git ls-remote, before anything is cloned orbuilt:
The checkout separates the two cases. GitHub only has
refs/pull/<N>/mergewhile it can merge the pull request into its base branch, so one that conflicts,
or one already closed, has only
refs/pull/<N>/head. That is still something totest - the pull request on its own rather than as it would land - so it is used,
with a warning saying which ref was tested and what the head ref does not have.
Nothing at all for that number remains an error.
And a parameter that is not there yet. A job only records a parameter once a
build has run with its definition, so the build that first sees a changed
Jenkinsfilehas the new ones asnull- and every build evaluates thewhenof the pull request stages, not only one asking for a pull request. They now fall
back to what the definition says the default is.
Tested
git ls-remoteagainst the three cases, with the branch of thecaseeach onetakes:
headandmergeTesting refs/pull/16420/mergeheadonlyTesting refs/pull/16357/headGenerated by Claude Code.